package array;

import util.TimeUtil;
import util.TimeUtil.Task;

public class Test {
	
	public static int fibo(int n) {
		if (n <= 2) {
			return 1;
		}
		return fibo(n - 1) + fibo(n - 2);
	}
	
	public static int fibo2(int n) {
		if (n <= 2) {
			return 1;
		}
		int[] num = new int[n + 1];
		num[1] = num[2] = 1;
		for (int i = 3; i <= n; i++) {
			num[i] = num[i - 1] + num[i - 2];
		}
		
		return num[n];
	}
	
	public static void main(String[] args) {
		TimeUtil.elapsed("fibo", new Task() {
			@Override
			public void execute() {
				fibo(30);
			}
		});
	}

}
